package com.bachongLightNovel.config;

import com.bachongLightNovel.interceptor.UserInfoInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author vermouth
 */

@Configuration
public class UserInfoConfig implements WebMvcConfigurer {

    /**
     * 添加用户信息拦截器
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(new UserInfoInterceptor())
                .excludePathPatterns("/api/system/user/login",
                        "/api/system/user/register",
                        "/api/system/upload",
                        "/api/works/novel/feign/**",
                        "/api/system/user/feign/**",
                        "/ws/socket/**",
                        "/error");
    }
}
